package com.example.framework.mqtt.core.client.impl;

import net.dreamlu.iot.mqtt.core.client.IMqttClientConnectListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tio.core.ChannelContext;

/**
 * <p>
 *
 * </p>
 *
 * @author sfjiang
 * @since 2024/11/26 17:38
 */
public class DefaultClientConnectListener implements IMqttClientConnectListener {

    private static final Logger log = LoggerFactory.getLogger(DefaultClientConnectListener.class);

    @Override
    public void onConnected(ChannelContext context, boolean isReconnect) {
        if (isReconnect) {
            log.info("[DefaultClientConnectListener] The reconnection to the MQTT server is successful!");
        } else {
            log.info("[DefaultClientConnectListener] The MQTT server is successfully connected!");
        }

    }

    @Override
    public void onDisconnect(ChannelContext context, Throwable throwable, String remark, boolean isRemove) {
        log.info("[DefaultClientConnectListener] Disconnect from the MQTT server...");
    }
}
